package leetcode.code1828;

import leetcode.IDebug;

//执行用时：35 ms, 在所有 Java 提交中击败了54.63%的用户
//
//内存消耗：41.8 MB, 在所有 Java 提交中击败了9.57%的用户
//
//通过测试用例：66 / 66
public class Solution implements IDebug {

	public int[] countPoints(int[][] points, int[][] queries) {
		int len = queries.length;
		int[] ans = new int[len];
		int size = points.length;
		for (int i = 0; i < len; i++) {
			int[] query = queries[i];
			int x = query[0], y = query[1], r = query[2];
			int cur = 0;
			for (int j = 0; j < size; j++) {
				int[] point = points[j];
				int m = point[0], n = point[1];
				int tmp1 = Math.abs(x - m);
				int tmp2 = Math.abs(y - n);
				int tmp3 = r * r;
				if (tmp1 * tmp1 + tmp2 * tmp2 <= tmp3) {
					cur++;
				}
			}
			ans[i] = cur;
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
